class Solution(object):
    def decode(self, encoded):
        n = len(encoded)
        ans = [0] * (n + 1)
        t = 0
        for i in range(1, n + 2):
            t ^= i
        pre = [0] * n
        pre[0] = encoded[0]
        for i in range(1, n):
            pre[i] = pre[i - 1] ^ encoded[i]
        q = 0
        for i in range(n):
            q ^= pre[i]
        ans[0] = t ^ q
        for i in range(1, n + 1):
            ans[i] = ans[0] ^ pre[i - 1]
        return ans

data = Solution()
encoded = [3,1]
print(data.decode(encoded))